package com.jy.api.controller.pos;

import com.jy.api.dao.KitchenPrintConfigDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by lihu on 2017/11/22.
 */
@Slf4j
@RestController
@RequestMapping(value = "v1/pos", produces = "application/json;charset=utf-8")
public class PosPrintConfigController {


    @Autowired
    KitchenPrintConfigDao kitchenPrintConfigDao;


    /**
     * 厨房打印设置获取
     *
     * @param storeId
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, value = "/kitchen/print-config")
    public ResponseEntity getkitchenPrintConfig(@RequestParam(name = "storeId") String storeId) {
        try {
            return new ResponseEntity(kitchenPrintConfigDao.findListByStoreIdAndEnabled(storeId,
                    true), HttpStatus.OK);
        } catch (Exception ex) {
            log.error("getkitchenPrintConfig is error==> storeId:{} ", storeId, ex);
            return new ResponseEntity("系统运行错误", HttpStatus.INTERNAL_SERVER_ERROR);
        }
    }
}
